Skip to content

Conversation

@vicroms
Copy link
Member

@vicroms vicroms commented Apr 22, 2025

Summary by Copilot:

This PR replaces the existing curl command line tool usage with direct libcurl API calls throughout the vcpkg codebase. The main goal is to improve reliability, error handling, and reduce external dependencies by using libcurl directly instead of spawning curl subprocesses.

  • Install libcurl headers on Linux CI runners.
  • Replace curl command-line invocations with libcurl API calls
  • Add new libcurl infrastructure with proper initialization and error handling
  • Update test expectations to match new libcurl error message format
  • Make z-upload-metrics work on non-Windows platforms

Before merging these changes, we require confirmation from telemetry that the large majority of non-Windows users have a system-installed libcurl.

TODO:

  • Add license notice

@vicroms vicroms requested a review from Copilot August 21, 2025 23:42

This comment was marked as outdated.

@microsoft microsoft deleted a comment from Copilot AI Aug 22, 2025
@vicroms vicroms force-pushed the link-libcurl branch 3 times, most recently from dedafaf to 8a25177 Compare August 22, 2025 09:37
@vicroms vicroms requested a review from Copilot August 24, 2025 21:44

This comment was marked as outdated.

This comment was marked as outdated.

@vicroms vicroms force-pushed the link-libcurl branch 2 times, most recently from 64cfadf to cddb978 Compare August 25, 2025 21:23
@microsoft microsoft deleted a comment from Copilot AI Aug 28, 2025
@microsoft microsoft deleted a comment from Copilot AI Aug 28, 2025
@microsoft microsoft deleted a comment from Copilot AI Aug 28, 2025
@vicroms vicroms changed the title [WIP][vcpkg-tool] Replace curl command calls with libcurl [vcpkg-tool] Replace curl command calls with libcurl Aug 28, 2025
@vicroms vicroms requested a review from Copilot August 28, 2025 22:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the existing curl command line tool usage with direct libcurl API calls throughout the vcpkg codebase. The goal is to improve reliability, error handling, and reduce external dependencies by using libcurl directly instead of spawning curl subprocesses.

Key changes include:

  • Adding new libcurl infrastructure with proper initialization and error handling
  • Replacing all curl command-line invocations with libcurl API calls in download, upload, and metrics functionality
  • Making the z-upload-metrics command work on non-Windows platforms by removing the Windows-only restriction

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vcpkg/metrics.cpp Replaces WinHTTP metrics upload with libcurl implementation and updates background process execution
src/vcpkg/commands.z-upload-metrics.cpp Removes Windows-only restriction and adds file deletion after upload
src/vcpkg/base/downloads.cpp Replaces all curl command-line calls with libcurl API calls for downloads, uploads, and HTTP requests
src/vcpkg/base/curl.cpp Adds new libcurl global initialization infrastructure
include/vcpkg/base/curl.h Provides libcurl header includes and initialization function
src/vcpkg/base/files.cpp Adds file size methods to ReadFilePointer for libcurl upload functionality
CMakeLists.txt Adds libcurl dependency and linking configuration
locales/messages.json Updates error message formats to match libcurl error reporting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vicroms vicroms marked this pull request as ready for review November 7, 2025 17:33
BillyONeal
BillyONeal previously approved these changes Nov 10, 2025
Comment on lines +556 to +559
maybe_accepted->is_integer() && maybe_errors->is_array())
{
auto item_received = maybe_received->integer(VCPKG_LINE_INFO);
auto item_accepted = maybe_accepted->integer(VCPKG_LINE_INFO);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this check followed by assert pattern but there's currently no maybe_integer so no change requested for now.

Comment on lines +53 to +57
set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB ON)
set(CMAKE_DISABLE_FIND_PACKAGE_LibPSL ON)
set(CMAKE_DISABLE_FIND_PACKAGE_LibSSH2 ON)
set(CMAKE_DISABLE_FIND_PACKAGE_Brotli ON)
set(CMAKE_DISABLE_FIND_PACKAGE_Zstd ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason to consider hosting ourselves rather than FetchContent would be to more easily support ZLIB for Content-encoding: deflate or gzip.

Co-authored-by: Billy O'Neal <[email protected]>
Co-authored-by: Thomas1664 <[email protected]>
@vicroms vicroms merged commit 1cc117b into microsoft:main Nov 17, 2025
7 checks passed
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this pull request Nov 18, 2025
BillyONeal added a commit that referenced this pull request Nov 18, 2025
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this pull request Nov 18, 2025
…ft#1660)"

This reverts commit 1cc117b.

# Conflicts:
#	locales/messages.json
@BillyONeal BillyONeal mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants